import { defHttp } from '/@/utils/http/axios';

enum Api {
  Crud = '/button',
  Table = '/button/table',
  List = '/button/list',
  Generate = '/button/generate',
}

export const getTableData = (params:any) => defHttp.get<ButtonItem[]>({ url: Api.Table, params: params });

export const getListData = () => defHttp.get<ButtonItem[]>({ url: Api.List });

export const create = (params: any) => defHttp.post({url: Api.Crud, params});

export const update = (params: any) => defHttp.put({url: Api.Crud, params});

export const deletes = (params: number[]) => defHttp.delete({url: Api.Crud, data: params});

export const generate = () => defHttp.post({url: Api.Generate});

export interface ButtonItem {
  ID: number,
  name: string;
  icon: string;
  func: string;
  selectedCount: number;
  uid: number;
  sort: number;
  memo: string;
}
